<template>
    <div class="edu-page-warp">
        <condition-card @reset="reset" @search="onSubmit" label-width="60px">
            <el-row :gutter="24" style="height: 50px;">
                <el-col :span="8">
                    <el-form-item :label="$t('examinationLevel.subject')">
                        <el-select v-model="queryParams.subject">
                            <el-option
                                v-for="item in options.subjects"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value"
                            ></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
        </condition-card>
        <el-card>
            <div class="edu-page-title mg-top">{{$t('examinationLevel.set')}}</div>
            <div class="edu-opertion-bar">
                <div class="float-right">
                    <el-button @click="addExamLevel" type="primary">{{$t('message.add')}}</el-button>
                </div>
            </div>
            <edu-table
                :url="api.pageUrl"
                ref="examinationLevelTable"
                size="mini"
                :selection="false"
            >
                <el-table-column :label="$t('examinationLevel.subjectName')" width="100">
                    <template slot-scope="scope">{{scope.row.subjectI18n}}</template>
                </el-table-column>
                <el-table-column :label="$t('examinationLevel.entry')" show-overflow-tooltip>
                    <template
                        slot-scope="scope"
                    >{{formatTime(scope.row.setBeginTime)}}-{{formatTime(scope.row.setEndTime)}}</template>
                </el-table-column>
                <el-table-column :label="$t('examinationLevel.examViewTime')" show-overflow-tooltip>
                    <template
                        slot-scope="scope"
                    >{{formatTime(scope.row.lookBeginTime)}}-{{formatTime(scope.row.lookEndTime)}}</template>
                </el-table-column>
                <el-table-column :label="$t('examinationLevel.resViewTime')" show-overflow-tooltip>
                    <template
                        slot-scope="scope"
                    >{{formatTime(scope.row.resultBeginTime)}}-{{formatTime(scope.row.resultEndTime)}}</template>
                </el-table-column>
                <el-table-column :label="$t('examinationLevel.resView')" width="100" align="center">
                    <template slot-scope="scope">                       
                        <el-tag
                            type="danger"
                            v-if="scope.row.resultOpen == 0"
                        >{{$t('message.disable')}}</el-tag>
                        <el-tag
                            type="success"
                            v-if="scope.row.resultOpen == 1"
                        >{{$t('message.enable')}}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column :label="$t('examinationLevel.examView')" width="100" align="center">
                    <template slot-scope="scope">                       
                        <el-tag
                            type="danger"
                            v-if="scope.row.examOpen == 0"
                        >{{$t('message.disable')}}</el-tag>
                        <el-tag
                            type="success"
                            v-if="scope.row.examOpen == 1"
                        >{{$t('message.enable')}}</el-tag>                       
                    </template>
                </el-table-column>
                <el-table-column :label="$t('message.operating')" width="90">
                    <template slot-scope="scope">
                        <el-button
                            type="text"
                            @click="editById(scope.row.id)"
                            size="mini"
                        >{{$t('message.edit')}}</el-button>
                        <el-button
                            type="text"
                            @click="deleteById([scope.row.id])"
                            size="mini"
                        >{{$t('message.delete')}}</el-button>
                    </template>
                </el-table-column>
            </edu-table>
        </el-card>
        <edu-dialog
            :title="dialogTitle"
            width="500px"
            :visible.sync="showDeptsDialog"
            @close="resetAddForm"
            @confirm="submitForm"
        >
            <el-form
                :model="createForm"
                ref="createForm"
                label-width="85px"
                :rules="rules"
                class="createForm"
                label-position="top"
            >
                <el-row>
                    <el-col :span="24">
                        <el-form-item prop="subject" :label="$t('examinationLevel.subject')">
                            <el-select v-model="createForm.subject">
                                <el-option
                                    v-for="item in options.subjects"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="11">
                        <el-form-item prop="setBeginTime" :label="$t('examinationLevel.entry')">
                            <el-date-picker
                                type="datetime"
                                value-format="timestamp"
                                :placeholder="$t('examinationLevel.inputBegin')"
                                v-model="createForm.setBeginTime"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <div style="text-align: center;margin-top:40px">-</div>
                    </el-col>
                    <el-col :span="11" style="margin-top:33px">
                        <el-date-picker
                            type="datetime"
                            value-format="timestamp"
                            :placeholder="$t('examinationLevel.inputEnd')"
                            @change="endTimeChange"
                            @clear="endTimeChange"
                            v-model="createForm.setEndTime"
                        ></el-date-picker>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="11">
                        <el-form-item
                            prop="lookBeginTime"
                            :label="$t('examinationLevel.examViewTime')"
                        >
                            <el-date-picker
                                type="datetime"
                                value-format="timestamp"
                                :placeholder="$t('examinationLevel.inputBegin')"
                                v-model="createForm.lookBeginTime"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <div style="text-align: center;margin-top:40px">-</div>
                    </el-col>
                    <el-col :span="11" style="margin-top:33px">
                        <el-date-picker
                            type="datetime"
                            value-format="timestamp"
                            :placeholder="$t('examinationLevel.inputEnd')"
                            @change="lookEndTimeChange"
                            @clear="lookEndTimeChange"
                            v-model="createForm.lookEndTime"
                        ></el-date-picker>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="11">
                        <el-form-item
                            prop="resultBeginTime"
                            :label="$t('examinationLevel.resViewTime')"
                        >
                            <el-date-picker
                                type="datetime"
                                value-format="timestamp"
                                :placeholder="$t('examinationLevel.inputBegin')"
                                v-model="createForm.resultBeginTime"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2">
                        <div style="text-align: center;margin-top:40px">-</div>
                    </el-col>
                    <el-col :span="11" style="margin-top:33px">
                        <el-date-picker
                            type="datetime"
                            value-format="timestamp"
                            :placeholder="$t('examinationLevel.inputEnd')"
                            @change="reEndTimeChange"
                            @clear="reEndTimeChange"
                            v-model="createForm.resultEndTime"
                        ></el-date-picker>
                    </el-col>
                </el-row>
                <el-row style="padding:0 0 5px">
                    <el-col :span="11">
                        <span style="color:red;margin-right:4px">*</span>
                        {{$t('examinationLevel.result')}}
                    </el-col>
                    <el-col :span="2">&nbsp;</el-col>
                    <el-col :span="11">
                        <span style="color:red;margin-right:4px">*</span>
                        {{$t('examinationLevel.examLevel')}}
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="11">
                        <el-form-item prop="resultOne.result">
                            <el-select v-model="createForm.resultOne.result">
                                <el-option
                                    v-for="item in options.results"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2" style="text-align: center;line-height:30px">=</el-col>
                    <el-col :span="11">
                        <el-form-item prop="resultOne.level">
                            <el-select v-model="createForm.resultOne.level">
                                <el-option
                                    v-for="item in options.levels"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="11">
                        <el-form-item prop="resultTwo.result">
                            <el-select v-model="createForm.resultTwo.result">
                                <el-option
                                    v-for="item in options.results"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2" style="text-align: center;line-height:30px">=</el-col>
                    <el-col :span="11">
                        <el-form-item prop="resultTwo.level">
                            <el-select v-model="createForm.resultTwo.level">
                                <el-option
                                    v-for="item in options.levels"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="11">
                        <el-form-item prop="resultThree.result">
                            <el-select v-model="createForm.resultThree.result">
                                <el-option
                                    v-for="item in options.results"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="2" style="text-align: center;line-height:30px">=</el-col>
                    <el-col :span="11">
                        <el-form-item prop="resultThree.level">
                            <el-select v-model="createForm.resultThree.level">
                                <el-option
                                    v-for="item in options.levels"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                ></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
        </edu-dialog>
    </div>
</template>
<script>
import examinationLevelApi from "common/src/api/welcomeService/examinationLevel";
import UTILS from "common/src/utils/utils";
import { mapState } from "vuex";
import { queryDic } from "common/src/api/dictionary";

/**
 * 分级考试
 */
export default {
    name: "ExaminationLevel",
    data() {
        return {
            showDeptsDialog: false,
            options: {
                subjects: [],
                results: [],
                levels: []
            },
            queryParams: {
                subject: ""
            },
            api: examinationLevelApi,
            isEdit: false,
            examinationLevels: [],
            createForm: {
                id: "",
                subject: "",
                setBeginTime: "",
                setEndTime: "",
                lookBeginTime: "",
                lookEndTime: "",
                resultBeginTime: "",
                resultEndTime: "",
                examinationLevelResultList: [],
                resultOne: {
                    result: "",
                    level: "",
                    sortNo: 1
                },
                resultTwo: {
                    result: "",
                    level: "",
                    sortNo: 2
                },
                resultThree: {
                    result: "",
                    level: "",
                    sortNo: 3
                }
            },

            rules: {
                subject: [
                    {
                        required: true,
                        message: this.$t("message.inputRequired"),
                        trigger: "blur"
                    }
                ],
                setBeginTime: [
                    {
                        required: true,
                        message: this.$t("message.inputRequired")
                    },
                    {
                        validator: this.checkTime,
                        trigger: "change"
                    }
                ],
                lookBeginTime: [
                    {
                        required: true,
                        message: this.$t("message.inputRequired")
                    },
                    {
                        validator: this.checkLookTime,
                        trigger: "change"
                    }
                ],
                resultBeginTime: [
                    {
                        required: true,
                        message: this.$t("message.inputRequired")
                    },
                    {
                        validator: this.checkResultTime,
                        trigger: "change"
                    }
                ],
                "resultOne.result": [
                    {
                        validator: this.checkResult,
                        trigger: "change"
                    }
                ],
                "resultOne.level": [
                    {
                        validator: this.checkLevel,
                        trigger: "change"
                    }
                ],
                "resultTwo.result": [
                    {
                        validator: this.checkResult,
                        trigger: "change"
                    }
                ],
                "resultTwo.level": [
                    {
                        validator: this.checkLevel,
                        trigger: "change"
                    }
                ],
                "resultThree.result": [
                    {
                        validator: this.checkResult,
                        trigger: "change"
                    }
                ],
                "resultThree.level": [
                    {
                        validator: this.checkLevel,
                        trigger: "change"
                    }
                ]
            }
        };
    },
    created() {},
    mounted() {
        this.init();
    },
    computed: {
        ...mapState({
            currentRole: state => {
                let mockUser = state.session.mockUser;
                let user = state.session.user;
                if (mockUser) {
                    if (
                        mockUser.currentRole == 1 &&
                        !mockUser.innerRoles.includes("1")
                    ) {
                        return "2";
                    } else {
                        return mockUser.currentRole;
                    }
                } else if (user.currentRole == 1) {
                    if (!user.innerRoles.includes("1")) {
                        return "2";
                    }
                }
                return user.currentRole;
            }
        })
    },
    methods: {
        formatTime(value, type) {
            if (UTILS.isEmpty(value)) {
                return value;
            }
            let pat = "YYYY/MM/DD HH:mm:ss";
            if ("d" == type) {
                pat = "YYYY/MM/DD";
            }
            return moment(value).format(pat);
        },
        checkTime(rule, value, callback) {
            if (value == null || !value) {
                callback(new Error(this.$t("message.inputRequired")));
            } else if (
                this.createForm.setEndTime &&
                value >= this.createForm.setEndTime
            ) {
                callback(new Error(this.$t("examinationLevel.timeError")));
            } else {
                callback();
            }
        },
        checkLookTime(rule, value, callback) {
            if (value == null || !value) {
                callback(new Error(this.$t("message.inputRequired")));
            } else if (
                this.createForm.lookEndTime &&
                value >= this.createForm.lookEndTime
            ) {
                callback(new Error(this.$t("examinationLevel.timeError")));
            } else {
                callback();
            }
        },
        checkResultTime(rule, value, callback) {
            if (value == null || !value) {
                callback(new Error(this.$t("message.inputRequired")));
            } else if (
                this.createForm.resultEndTime &&
                value >= this.createForm.resultEndTime
            ) {
                callback(new Error(this.$t("examinationLevel.timeError")));
            } else {
                callback();
            }
        },
        // checkLookTime(rule, value, callback) {
        //     let flag = value < this.createForm.setBeginTime
        //                 || value > this.createForm.setEndTime
        //                 || this.createForm.lookEndTime
        //                 || this.createForm.lookEndTime > this.createForm.setEndTime
        //     if(!this.createForm.setBeginTime){
        //         callback(new Error(this.$t("examinationLevel.plsinputexamSetTime")));
        //     }else if (value == null || !value) {
        //         callback(new Error(this.$t("message.inputRequired")));
        //     } else if (
        //         this.createForm.lookEndTime &&
        //         value >= this.createForm.lookEndTime
        //     ) {
        //         callback(new Error(this.$t("examinationLevel.timeError")));
        //     } else if(this.createForm.setEndTime && flag){
        //         callback(new Error(this.$t("examinationLevel.lookTimeError")));
        //     } else if(!this.createForm.setEndTime && value< this.createForm.setBeginTime){
        //         callback(new Error(this.$t("examinationLevel.lookTimeError")));
        //     }
        //     else {
        //         callback();
        //     }
        // },
        // checkResultTime(rule, value, callback) {
        //     let flag = value < this.createForm.lookBeginTime
        //     || value > this.createForm.lookEndTime
        //     || !this.createForm.resultEndTime
        //     || this.createForm.resultEndTime > this.createForm.lookEndTime
        //     if(!this.createForm.lookBeginTime){
        //         callback(new Error(this.$t("examinationLevel.plsinputexamLookTime")));
        //     } else if (value == null || !value) {
        //         callback(new Error(this.$t("message.inputRequired")));
        //     } else if (
        //         this.createForm.resultEndTime &&
        //         value >= this.createForm.resultEndTime
        //     ) {
        //         callback(new Error(this.$t("examinationLevel.timeError")));
        //     } else if(this.createForm.lookEndTime && flag){
        //         callback(new Error(this.$t("examinationLevel.resTimeError")));
        //     } else if(!this.createForm.lookEndTime && value< this.createForm.lookBeginTime){
        //         callback(new Error(this.$t("examinationLevel.resTimeError")));
        //     }else {
        //         callback();
        //     }
        // },
        checkLevel(rule, value, callback) {
            console.log(rule, value);
            if (!value) {
                callback(new Error(this.$t("message.inputRequired")));
            } else {
                let flag = true;
                switch (rule.field) {
                    case "resultOne.level":
                        if (
                            value == this.createForm.resultTwo.level ||
                            value == this.createForm.resultThree.level
                        )
                            flag = false;
                        break;
                    case "resultTwo.level":
                        if (
                            value == this.createForm.resultOne.level ||
                            value == this.createForm.resultThree.level
                        )
                            flag = false;
                        break;
                    case "resultThree.level":
                        if (
                            value == this.createForm.resultOne.level ||
                            value == this.createForm.resultTwo.level
                        )
                            flag = false;
                        break;
                }
                if (flag) {
                    callback();
                } else {
                    callback(
                        new Error(this.$t("examinationLevel.examLevelHas"))
                    );
                }
            }
        },
        checkResult(rule, value, callback) {
            console.log(rule, value);
            if (!value) {
                callback(new Error(this.$t("message.inputRequired")));
            } else {
                let flag = true;
                switch (rule.field) {
                    case "resultOne.result":
                        if (
                            value == this.createForm.resultTwo.result ||
                            value == this.createForm.resultThree.result
                        )
                            flag = false;
                        break;
                    case "resultTwo.result":
                        if (
                            value == this.createForm.resultOne.result ||
                            value == this.createForm.resultThree.result
                        )
                            flag = false;
                        break;
                    case "resultThree.result":
                        if (
                            value == this.createForm.resultOne.result ||
                            value == this.createForm.resultTwo.result
                        )
                            flag = false;
                        break;
                }
                if (flag) {
                    callback();
                } else {
                    callback(new Error(this.$t("examinationLevel.resultHas")));
                }
            }
        },
        init() {
            // let yes = { label: this.$t("message.yes"), value: "1" };
            // let no = { label: this.$t("message.no"), value: "0" };
            //筛选条件字典查询
            let data = {
                lang: this.$store.getters.language || "cn",
                type: "allChild",
                keys: ["X_KCKM", "X_RXKSCJ", "X_CJDJ"]
            };
            queryDic(data).then(res => {
                if (res.code == 200) {
                    UTILS.fillSelect(
                        {
                            subjects: "X_KCKM",
                            results: "X_RXKSCJ",
                            levels: "X_CJDJ"
                        },
                        res.data,
                        this.options
                    );
                }
            });
            this.onSubmit();
        },
        onSubmit() {
            this.$refs.examinationLevelTable.search(this.queryParams);
        },
        deleteById(id) {
            this.$confirm(
                this.$t("message.deleteConfirm"),
                this.$t("message.prompt"),
                {
                    confirmButtonText: this.$t("message.confirm"),
                    cancelButtonText: this.$t("message.cancel"),
                    type: "warning"
                }
            ).then(() => {
                examinationLevelApi.deleteById(id).then(res => {
                    if (res.code == 200) {
                        this.$message({
                            type: "success",
                            message: this.$t("message.deleteSuccess")
                        });
                        this.onSubmit();
                    }
                });
            });
        },
        reset() {
            this.queryParams.subject = "";
            this.onSubmit();
        },
        editById(id) {
            this.isEdit = true;
            examinationLevelApi.findById(id).then(res => {
                if (res.code == 200) {
                    Object.keys(res.data).forEach(k => {
                        if (this.createForm.hasOwnProperty(k)) {
                            this.createForm[k] =
                                res.data[k] == 0 || res.data[k] == 1
                                    ? res.data[k].toString()
                                    : res.data[k];
                        }
                    });
                    this.createForm.setBeginTime = moment(
                        res.data.setBeginTime
                    ).toDate();
                    if (res.data.setEndTime) {
                        this.createForm.setEndTime = moment(
                            res.data.setEndTime
                        ).toDate();
                    }
                    this.createForm.lookBeginTime = moment(
                        res.data.lookBeginTime
                    ).toDate();
                    if (res.data.lookEndTime) {
                        this.createForm.lookEndTime = moment(
                            res.data.lookEndTime
                        ).toDate();
                    }
                    this.createForm.resultBeginTime = moment(
                        res.data.resultBeginTime
                    ).toDate();
                    if (res.data.resultEndTime) {
                        this.createForm.resultEndTime = moment(
                            res.data.resultEndTime
                        ).toDate();
                    }
                    this.createForm.resultOne.result =
                        res.data.examinationLevelResultList[0].result;
                    this.createForm.resultOne.level =
                        res.data.examinationLevelResultList[0].level;
                    this.createForm.resultTwo.result =
                        res.data.examinationLevelResultList[1].result;
                    this.createForm.resultTwo.level =
                        res.data.examinationLevelResultList[1].level;
                    this.createForm.resultThree.result =
                        res.data.examinationLevelResultList[2].result;
                    this.createForm.resultThree.level =
                        res.data.examinationLevelResultList[2].level;
                    this.showDialog = true;
                }
            });
            this.dialogTitle = this.$t("message.edit");
            this.showDeptsDialog = true;
        },
        addExamLevel() {
            this.isEdit = false;
            this.createForm.id = "";
            this.dialogTitle = this.$t("message.add");
            this.showDeptsDialog = true;
        },
        resetAddForm() {
            this.$refs.createForm.clearValidate();
            this.createForm.id = "";
            this.createForm.subject = "";
            this.createForm.setBeginTime = "";
            this.createForm.setEndTime = "";
            this.createForm.lookBeginTime = "";
            this.createForm.lookEndTime = "";
            this.createForm.resultBeginTime = "";
            this.createForm.resultEndTime = "";
            this.createForm.resultOne.result = "";
            this.createForm.resultOne.level = "";
            this.createForm.resultTwo.result = "";
            this.createForm.resultTwo.level = "";
            this.createForm.resultThree.result = "";
            this.createForm.resultThree.level = "";
            // for (const key in this.createForm) {
            //   this.createForm[key] = "";
            // }
            // this.createForm.isWeekend = "1";
        },
        submitForm() {
            this.$refs.createForm.validate(valid => {
                if (!valid) {
                    return;
                }
                if (this.createForm.id) {
                    this.createForm.examinationLevelResultList = [];
                    this.createForm.examinationLevelResultList.push(
                        this.createForm.resultOne
                    );
                    this.createForm.examinationLevelResultList.push(
                        this.createForm.resultTwo
                    );
                    this.createForm.examinationLevelResultList.push(
                        this.createForm.resultThree
                    );

                    let postData = _.cloneDeep(this.createForm);
                    postData.setEndTime = this.changeEndTime(
                        postData.setEndTime
                    );
                    postData.lookEndTime = this.changeEndTime(
                        postData.lookEndTime
                    );
                    postData.resultEndTime = this.changeEndTime(
                        postData.resultEndTime
                    );

                    examinationLevelApi.updateById(postData).then(response => {
                        if (response.code == 200) {
                            this.showDialog = false;
                            this.$message({
                                type: "success",
                                message: this.$t("message.saveSuccess")
                            });
                            this.createForm.id = "";
                            this.showDeptsDialog = false;
                            this.onSubmit();
                        }
                    });
                } else {
                    this.createForm.examinationLevelResultList = [];
                    this.createForm.examinationLevelResultList.push(
                        this.createForm.resultOne
                    );
                    this.createForm.examinationLevelResultList.push(
                        this.createForm.resultTwo
                    );
                    this.createForm.examinationLevelResultList.push(
                        this.createForm.resultThree
                    );
                    examinationLevelApi.save(this.createForm).then(response => {
                        if (response.code == 200) {
                            this.showDialog = false;
                            this.$message({
                                type: "success",
                                message: this.$t("message.saveSuccess")
                            });
                            this.showDeptsDialog = false;
                            this.onSubmit();
                        }
                    });
                }
            });
        },
        changeEndTime(timestamp) {
            if (timestamp) {
                let d = new Date(timestamp);
                return moment(d).format("YYYY-MM-DD HH:mm:ss");
            } else {
                return null;
            }
        },
        endTimeChange() {
            this.$refs.createForm.validateField("setBeginTime");
        },
        lookEndTimeChange() {
            this.$refs.createForm.validateField("lookBeginTime");
        },
        reEndTimeChange() {
            this.$refs.createForm.validateField("resultBeginTime");
        },
        changResult(id, type) {
            let data = { id: id, resultOpen: type };
            examinationLevelApi.updateSwitch(data).then(response => {
                if (response.code == 200) {
                    this.showDialog = false;
                    this.$message({
                        type: "success",
                        message: this.$t("message.saveSuccess")
                    });
                    this.onSubmit();
                }
            });
        },
        changLevel(id, type) {
            console.info(this.currentRole);
            let data = {};
            if (type == 0) {
                data = { id: id, examOpen: type, resultOpen: type };
            } else {
                data = { id: id, examOpen: type };
            }
            examinationLevelApi.updateSwitch(data).then(response => {
                if (response.code == 200) {
                    this.showDialog = false;
                    this.$message({
                        type: "success",
                        message: this.$t("message.saveSuccess")
                    });
                    this.onSubmit();
                }
            });
        }
    }
};
</script>

<style lang="scss" scoped>
.createForm {
    .line {
        text-align: center;
    }
    .el-date-editor.el-input,
    .el-date-editor.el-input__inner {
        width: 100%;
    }
    .el-select {
        width: 100%;
    }
}
.edu-page-warp .level-button {
    min-width: 0px;
    padding: 0 8px;
    height: 24px;
}
</style>
